//
//  BGZNXCell.m
//  bigMall
//
//  Created by ios on 16/8/30.
//  Copyright © 2016年 thinklev. All rights reserved.
//

#import "BGZNXCell.h"

@implementation BGZNXCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (void)layoutSubviews {
    
    for (UIView *v in self.contentView.subviews) {
        
        if ([v isKindOfClass:[UIView class]]) {
            [v removeFromSuperview];
        }
    }
    
    //顶部修饰条
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 90)];
    [self.contentView addSubview:view];
    UIView *smallView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 10)];
    smallView.backgroundColor = dockwhite_;
    [view addSubview:smallView];
    
    //物种类
    UILabel *_wuzhong = [[UILabel alloc] init];
    _wuzhong.font = [UIFont systemFontOfSize:18];
    _wuzhong.text = _wuzhongStr;
    CGSize wuzhongSize = [_wuzhong.text sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:_wuzhong.font,NSFontAttributeName, nil]];
    _wuzhong.frame = CGRectMake(21, smallView.bottom + 10, ([UIScreen mainScreen].bounds.size.width - 42) / 2, wuzhongSize.height);
    
    [view addSubview:_wuzhong];
    
    //时间啊
    UILabel *_time = [[UILabel alloc] init];
    _time.font = [UIFont systemFontOfSize:14];
    _time.textColor = lightGray_;
    NSDate *dat = [NSDate dateWithTimeIntervalSince1970:[_timeStr intValue]];
    NSDateFormatter*df = [[NSDateFormatter alloc]init];
    [df setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *str = [df stringFromDate:dat];
    _time.text = str;
    _time.textAlignment = NSTextAlignmentRight;
    CGSize timeSize = [_time.text sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:_time.font,NSFontAttributeName, nil]];
    _time.frame = CGRectMake([UIScreen mainScreen].bounds.size.width - 21 - timeSize.width, smallView.bottom + 12, timeSize.width, timeSize.height);
    ;
    [view addSubview:_time];
    
    //remark
    UILabel *_remark = [[UILabel alloc] init];
    _remark.font = [UIFont systemFontOfSize:16];
    _remark.text = _remarkStr;
    CGSize remarkSize = [_remark.text sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:_remark.font,NSFontAttributeName, nil]];
    _remark.frame = CGRectMake( 21, _wuzhong.bottom + 14, [UIScreen mainScreen].bounds.size.width - 74, remarkSize.height);
    
    [view addSubview:_remark];

}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
